package cn.kgc.crowd1048.fundingadmin.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.*;
import lombok.experimental.Accessors;

import java.beans.Transient;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 
 * </p>
 *
 * @author zwr
 * @since 2024-04-22
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ToString
@Getter
@Setter
@AllArgsConstructor // 生成一个包含所有字段的有参构造器
@NoArgsConstructor  // 生成一个无参构造器
public class Menu implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    private Integer pid;

    private String name;

    private String icon;

    private String url;

    // 当前节点的子节点集合，设置默认值是为了避免组装节点时空指针异常
    @TableField(exist = false)
    private List<Menu> children = new ArrayList<>();

    // 控制节点展开还是折叠，设置为true是让整个树形菜单默认展开
    @TableField(exist = false)
    private Boolean open = true;


}
